package main

func lengthOfLongestSubstring(s string) int {
	length := len(s)
	val := 0
	for i := 0; i < length; i++ {
		hash := make(map[int32]int)
		j := 0
		for _, v := range s[i:] {
			if _, ok := hash[v]; ok {
				break
			}
			hash[v] = j
			j++
		}
		if j > val {
			val = j
		}
	}
	if val == 0 {
		val = length
	}
	return val
}
